#pragma once

#include <QTreeWidgetItem>
#include <QVariant>
#include <QWidget>
#include "actorbase.h"
#include "publicgui_global.h"
#include "datatypedefine.h"

namespace PublicGui
{
	class DynamicTreeWidgetItemBase:public QObject,public QTreeWidgetItem
	{
		Q_OBJECT
	public:
		DynamicTreeWidgetItemBase();
		~DynamicTreeWidgetItemBase();
		virtual void setItemData(CoreBase::ActorBase* actorptr,const QString& tag);
		CoreBase::ActorBase* getItemActor();
		virtual QVariant getItemData();
		QMap<QTreeWidgetItem*,QWidget*> getItemAllChild();
		virtual void setLabelTextList(QStringList mtext);
		virtual void setValueChangeAutoRefresh(bool refresh);
	protected:
		virtual void initializationUi();
		virtual void emitValueChanged(){}
		CoreBase::ActorBase*				_actorPtr;
		QVariant							_itemData;
		QMap<QTreeWidgetItem*,QWidget*>		_itemChild;
		QString								_tag;
		bool								_refresh;
		bool								_connectApplicationSignal;
	protected slots:
		virtual void slotFocusChanged(QWidget*,QWidget*);
	};
}